package com.loongxun.xxapp.ui.user;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

import com.loongxun.xxapp.R;
import com.loongxun.xxapp.adapter.MailAdapter;
import com.loongxun.xxapp.model.User;

import java.util.ArrayList;
import java.util.List;

/**
 * 通讯录
 * Created by Administrator on 2017/10/27.
 */
public class MailListActivity extends Activity implements View.OnClickListener{

    private TextView tv_title;

    private ListView lv_list;
    private List<User> users;
    private MailAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mail_list);

        findViewById(R.id.iv_back).setOnClickListener(this);
        tv_title = (TextView) findViewById(R.id.tv_title);
        tv_title.setText("通讯录");

        users = new ArrayList<>();
        for (int i= 0;i<10;i++){
            User user = new User();
            user.setUserName("张某");
            if (i==5){
                user.setStart(1);
            }else {
                user.setStart(0);
            }
            users.add(user);
        }
        lv_list = (ListView) findViewById(R.id.lv_list);
        adapter = new MailAdapter(this,users);
        lv_list.setAdapter(adapter);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.iv_back:
                finish();
                break;
            default:
                break;
        }
    }
}
